// components/ml-byte/ml-byte.js
Component({
  options: {
    styleIsolation: 'isolated'
  },
  /**
   * 组件的属性列表
   */
  properties: {
    value: {
      type: Number,
      default: 0,
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    changeValue(event) {
      const diff = Number(event.currentTarget.dataset.diff);
      let result = Number(this.data.value) + diff;
      result = result < 0 ? 0 : result;
      this.setData({value: result})
    }
  }
})
